<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var minimumReplacement = function(nums) {
    let n = nums.length;
    let ans = 0;
    for(let i = n-2; i>=0; --i){
        if(nums[i]>nums[i+1]){
            let temp = (nums[i]-1)/nums[i+1] | 0; //操作次数
            ans += temp;
            nums[i] = nums[i] /(temp+1) | 0;//拆分元素, nums[i]分成(temp+1)份;
        }
    }
    return ans;
};
</script>
</html>